<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <script crossorigin="anonymous" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh" src="https://lib.baomitu.com/jquery/3.4.1/jquery.min.js"></script>
    <script>
        $(function () {
            $("#reg_btn").on("click",function () {

                var url = "../user/loginSubmit.action"; //为什么?
                var data = $("#myform").serialize();
                $.post(url,data,function (obj) {
                    if(obj.state==1){
                        location.href="userInfo.html";
                    }else{
                        alert("用户名和密码错误!");
                    }
                },"json")
            })
        })
    </script>
</head>
<body>
<form action="" method="post" id="myform">
    <p>用户名<input type="text" name="userName"></p>
    <p>密码<input type="text" name="userPassword"></p>
    <p><input type="button" id="reg_btn" value="登录"> </p>
</form>
</body>
</html>